
package com.cn.xiaonuo.tcrfinance.tcrusers.controller;


import com.cn.xiaonuo.common.entity.BusinessMessage;
import com.cn.xiaonuo.common.utils.ApiJsonModel;
import com.cn.xiaonuo.slbfinances.shopassets.param.PageMerchantAssetsParam;
import com.cn.xiaonuo.tcrfinance.tcrusers.param.AuthenticationParam;
import com.cn.xiaonuo.tcrfinance.tcrusers.param.MasterAccountExcelParam;
import com.cn.xiaonuo.tcrfinance.tcrusers.param.UserListParam;
import com.cn.xiaonuo.tcrfinance.tcrusers.service.IdentityRevocationService;
import com.cn.xiaonuo.tcrfinance.tcrusers.service.PvLoginUserService;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.util.Map;


@RestController
public class HpcUserController {

    @Autowired
    private PvLoginUserService loginService;
    @Autowired
    private IdentityRevocationService identityRevocationService;



    @ApiOperation(value = "银行卡绑定查询", notes = "银行卡绑定查询")
    @ApiJsonModel({
            @ApiModelProperty(name = "accounts", value = "交易账号",example = "10086"),
            @ApiModelProperty(name = "pageSize", value = "每页显示多少数量",example = "10",required = true),
            @ApiModelProperty(name = "pageNo", value = "页码",example = "1",required = true)
    })
    @RequestMapping(value = "/api/users/selectHtUserInfobindCard", method = RequestMethod.POST)
    public BusinessMessage selectHtUserInfoBg(@RequestBody Map<String, Object> params) {
        BusinessMessage message = loginService.selectHtUserInfo(params);
        return message;
    }

    @ApiOperation(value = "银行卡绑定修改", notes = "银行卡绑定修改")
    @ApiJsonModel({
            @ApiModelProperty(name = "accounts", value = "交易账号",example = "交易账号（true）",required = true),
            @ApiModelProperty(name = "username", value = "用户名",example = "用户名（true）",required = true),
            @ApiModelProperty(name = "realname", value = "真实姓名",example = "真实姓名（true）",required = true),
            @ApiModelProperty(name = "phone", value = "手机号",example = "手机号（true）",required = true),
            @ApiModelProperty(name = "cardnumber", value = "证件号码",example = "证件号码（true）",required = true),
            @ApiModelProperty(name = "openbankadd", value = "银行卡对应的开户行",example = "银行卡对应的开户行（true）",required = true),
            @ApiModelProperty(name = "banknumber", value = "银行卡号",example = "银行卡号（true）",required = true),
            @ApiModelProperty(name = "reservephone", value = "银行预留手机号码",example = "银行预留手机号码（true）",required = true),
            @ApiModelProperty(name = "operationid", value = "操作用户ID",example = "操作用户ID（true）",required = true)
    })
    @RequestMapping(value = "/api/users/updateHtUserInfobindCard", method = RequestMethod.POST)
    public BusinessMessage updateHtUserInfoBg(@RequestBody Map<String, Object> params) {
        BusinessMessage message = loginService.updateHtUserInfo(params);
        return message;
    }

    @ApiOperation(value = "会员管理-会员管理模糊分页查询", notes = "会员管理-会员管理模糊分页查询")
    @ApiJsonModel({
            @ApiModelProperty(name = "accounts", value = "交易账号",example = "10086"),
            @ApiModelProperty(name = "phone", value = "电话号码",example = "13800138000"),
            @ApiModelProperty(name = "pageSize", value = "每页显示多少数量",example = "10",required = true),
            @ApiModelProperty(name = "pageNo", value = "页数",example = "1",required = true)
    })
    @RequestMapping(value = "/api/users/queryUserList", method = RequestMethod.POST)
    public BusinessMessage queryUserList(@RequestBody UserListParam params) {
        BusinessMessage message = loginService.queryUserList(params);
        return message;
    }

    @ApiOperation(value = "会员管理-会员详情查询", notes = "会员管理-会员详情查询")
    @RequestMapping(value = "/api/users/queryUserDetail", method = RequestMethod.POST)
    public BusinessMessage queryUserDetail(@RequestBody AuthenticationParam param) {
        BusinessMessage message = loginService.queryUserDetail(param);
        return message;
    }

    @ApiOperation(value = "会员管理-实名认证审核", notes = "会员管理-实名认证审核")
    @RequestMapping(value = "/api/users/updateAuditStatus", method = RequestMethod.POST)
    public BusinessMessage updateAuditStatus(@RequestBody AuthenticationParam param) {
        BusinessMessage message = loginService.updateAuditStatus(param);
        return message;
    }

    @ApiOperation(value = "会员管理-体验会员列表", notes = "会员管理-体验会员列表")
    @RequestMapping(value = "/api/users/experienceUserList", method = RequestMethod.POST)
    public BusinessMessage experienceUserList(@RequestBody UserListParam params) {
        BusinessMessage message = loginService.experienceUserList(params);
        return message;
    }

    @ApiOperation(value = "会员管理-取消体验", notes = "会员管理-取消体验")
    @RequestMapping(value = "/api/users/cancelExperience", method = RequestMethod.POST)
    public BusinessMessage cancelExperience(@RequestBody Integer userId) {
        BusinessMessage message = loginService.cancelExperience(userId);
        return message;
    }

    @ApiOperation(value = "总账号导出(新)", notes = "总账号导出(新)")
    @RequestMapping(value ="/api/users/newMasterAccountExcel", method = RequestMethod.GET)
    public void newMasterAccountExcel(HttpServletResponse response, MasterAccountExcelParam param){
        loginService.newMasterAccountExcel(response,param);
    }

    @ApiOperation(value = "批量回收解封体验用户-转让代持商品", notes = "批量回收解封体验用户-转让代持商品")
    @RequestMapping(value = "/api/users/exUserTransference", method = RequestMethod.POST)
    public BusinessMessage exUserTransference(MultipartFile file) {
        BusinessMessage message = loginService.exUserTransference(file);
        return message;
    }

    @ApiOperation(value = "批量回收解封体验用户-批量撤销体验用户身份", notes = "批量回收解封体验用户-批量撤销体验用户身份")
    @RequestMapping(value = "/api/users/identityRevocation", method = RequestMethod.POST)
    public BusinessMessage identityRevocation(MultipartFile file) {
            BusinessMessage message = identityRevocationService.identityRevocation(file);
        return message;
    }


    @ApiOperation(value = "批量回收解封体验用户-椒易宝体验用户数据清除", notes = "批量回收解封体验用户-椒易宝体验用户数据清除")
    @RequestMapping(value = "/api/users/jybExperienceGwqClear", method = RequestMethod.POST)
    public BusinessMessage jybExperienceGwqClear(MultipartFile file) {
        BusinessMessage message = identityRevocationService.jybExperienceGwqClear(file);
        return message;
    }
}
